package com.ty.user.starter.entity.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.io.Serializable;

@Data
public class UserVo implements Serializable {

    private static final long serialVersionUID = -6606385624303617791L;

    @ApiModelProperty("id")
    private Long id;

    @ApiModelProperty("部门id")
    private Long deptId;
    @ApiModelProperty("部门名称")
    private String deptName;

    @ApiModelProperty(value = "用户名")
    private String username;

    @ApiModelProperty("联系人")
    private String realName;

    @ApiModelProperty("联系地址")
    private String address;

    @ApiModelProperty("电话号码")
    private String phone;

    @ApiModelProperty("身份证号码")
    private String idCard;

    @ApiModelProperty("用户头像")
    private String headUrl;

    @ApiModelProperty("其它字段")
    private String other;

    /**
     * 重写获取头像方法,如果未设置头像信息,则显示默认头像
     *
     * @return 头像地址
     */
    public String getHeadUrl() {
        if (StringUtils.hasText(headUrl)) {
            return headUrl;
        }
        return "/static/image/header.jpg";
    }
}
